package customview.demo;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.view.View;
import android.widget.LinearLayout.LayoutParams;

public class ButtonView extends View {
	
	private Paint graphPaint = null;
	
	public ButtonView(Context context, int width, int height) {
		super(context);
		this.setFocusableInTouchMode(true);
		setFocusable(true);  
		setLayoutParams(new LayoutParams(width, height));  
		init();
	}

	private void init() {
		graphPaint = new Paint();
		graphPaint.setARGB(200, 0, 0, 0);
		graphPaint.setAntiAlias(true);
		graphPaint.setDither(true);
		graphPaint.setStyle(Style.FILL);
	}

	@Override
	protected void onFocusChanged(boolean gainFocus, int direction,
			Rect previouslyFocusedRect) {

		super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
	}
	
	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		canvas.drawRect(0, 0, 100, 100, graphPaint);
	}
	
}
